import 'package:mobile_app.core/core/domain/entities/dialect.dart';
import 'package:mobile_app.core/core/domain/entities/settings/pronunciation_settings.dart';
import 'package:mobile_app.core/core/domain/entities/tts_voice.dart';

abstract class UpdatePronunciationSettingsFromVoice {
  PronunciationSettings call({
    required PronunciationSettings pronunciationSettings,
    required TtsVoice updatedVoice,
  });
}

class UpdatePronunciationSettingsFromVoiceImpl implements UpdatePronunciationSettingsFromVoice {
  const UpdatePronunciationSettingsFromVoiceImpl();

  @override
  PronunciationSettings call({
    required PronunciationSettings pronunciationSettings,
    required TtsVoice updatedVoice,
  }) {
    switch (updatedVoice.dialect) {
      case Dialect.am:
        return pronunciationSettings.copyWith(
          dialect: () => updatedVoice.dialect,
          amVoiceTitle: () => updatedVoice.title,
        );

      case Dialect.br:
        return pronunciationSettings.copyWith(
          dialect: () => updatedVoice.dialect,
          brVoiceTitle: () => updatedVoice.title,
        );
    }
  }
}
